<?php
include("db_connect.php");
include('session.php');

function outputButtons($id) {
	 echo '<input type="radio" name="button' . $id . '" value="1"> Strongly disagree';
	 echo '<input type="radio" name="button' . $id . '" value="2"> Disagree';
	 echo '<input type="radio" name="button' . $id . '" value="3"> Neutral';
	 echo '<input type="radio" name="button' . $id . '" value="4"> Agree';
	 echo '<input type="radio" name="button' . $id . '" value="5"> Strongly agree';
	 echo '<br /><br />';
}

?>

<html>
<head>
<title>Find Your Match</title>
</head>

<body>
<h1>Find Your Match</h1>

<form action="compare.php" method="POST">
Name: <input type="text" name="name"><br />

<?php
if(isset($_SESSION['user_id'])) {
$result = mysql_query("SELECT id, question FROM questions");
while($row = mysql_fetch_array($result)) {
  echo $row['question'] . '<br />';
  outputButtons($row['id']);
  }
  }
  else{
echo "Please Log in";
  }
?>

<input type="submit" value="Compare" />
</form>
</body>
</html>
